﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Polygon
{
    class Polygon
    {
        protected int width;
        protected int height;
        public void SetValues(int a, int b)
        {
            width = a;
            height = b;
        }
        class Rectang : Polygon
        {
            public int area()
            {
                return (width * height);
            }
            class Triangle : Polygon
            {
                public int area()
                {
                    return (width * height / 2);
                }
                class Program
                {
                    static void Main(string[] args)
                    {
                        Rectang rect = new Rectang();
                        Triangle trgl = new Triangle();
                        rect.SetValues(4, 5);
                        trgl.SetValues(4, 5);
                        Console.WriteLine("rect a:{0}",rect.area());
                        Console.WriteLine("trglb:{0}", trgl.area());
                        return;
                    }
                }
            }
        }

    }
}
    